package com.castle.fortress.admin.cms.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.castle.fortress.admin.utils.BizCommonUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
/**
 * cms模型字段配置表 实体类
 *
 * @author castle
 * @since 2022-03-03
 */
@Data
@TableName("cms_col_config")
public class CmsColConfigEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	/**
	 * 主键
	*/
	@JsonSerialize(using = ToStringSerializer.class)
	@TableId(
			value = "id",
			type = IdType.ASSIGN_ID
	)
	private Long id;
	/**
	 * 模型id
	*/
	@JsonSerialize(using = ToStringSerializer.class)
	private Long modelId;
	/**
	 * 字段标题
	*/
	private String colTitle;
	/**
	 * 字段名
	*/
	private String colName;
	/**
	 * 标签引用名
	*/
	private String propName;
	/**
	 * 字段类型
	*/
	private String colType;
	/**
	 * 属性类型
	*/
	private String propType;
	/**
	 * 是否必填
	*/
	private Integer isFormRequire;
	/**
	 * 校验类型
	*/
	private Integer validateType;
	/**
	 * 表单类型
	*/
	private Integer formType;
	/**
	 * 数据集
	*/
	private String listdataConfig;
	/**
	 * 数量限制
	*/
	private Integer limitSize;

	@Override
	public boolean equals(Object obj) {
		if(this == obj){
			return true;//地址相等
		}
		if(obj == null){
			return false;//非空性：对于任意非空引用x，x.equals(null)应该返回false。
		}
		if(obj instanceof CmsColConfigEntity){
			CmsColConfigEntity other = (CmsColConfigEntity) obj;
			//需要比较的字段相等，则这两个对象相等
			if(BizCommonUtil.equalsStr(this.colName, other.colName)
							&& BizCommonUtil.equalsStr(this.colType, other.colType)
							&& BizCommonUtil.equalsStr(this.colTitle, other.colTitle)){
				return true;
			}
		}
		return false;
	}
}
